<html>
<head>
<title>首页</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=no, minimal-ui" />
		<meta name="apple-mobile-web-app-capable" content="yes" />
<link rel="stylesheet" type="text/css" href="css.css"/>
<link rel="stylesheet" href="/bootstrap.min.css">
</head>
<body>
<%- include('header') -%>
<div class="banner">
	<img src="banner.png" />
</div>
<div class="item">
	<h2><a class="pull-right more" href="/list">more</a>超低折扣</h2>
	<ul>
	<% for(var i=0; i<db.length; i++) {%>
	   <li><%= i+1 %>、<a href="/list/<%= i+1 %>"><%= db[i]['title'] %></a></li>
	<% } %>
	</ul>
</div>
<form id="msg-board"  method="POST" action="/submsg">
<h2>留言</h2>
<ul>
	<li>
		<label for="user-name">姓名:</label>
		<input id="user-name" name="user" type="text" placeholder="源人" />
	</li>
	<li>
		<label for="user-phone">电话:</label>
		<input id="user-phone" name="phone" type="text" placeholder="13912334444" />
	</li>
	<li>
		<label for="user-msg">您要说的话:</label>
		<textarea name="msg" id="user-msg" cols="30" rows="10" placeholder="想说点啥呢？"></textarea>
		<span class="tips"></span>
	</li>
	<li>
		<input id="sub-btn" type="submit" value="留言" />	
	</li>
</ul>
</form>
<%- include('footer') -%>
<script>
	var uName = document.querySelector('#user-name');
	var uPhone = document.querySelector('#user-phone');
	var uMsg = document.querySelector('#user-msg');
	var subBtn = document.querySelector('#sub-btn');
	var tips = document.querySelector('.tips');
		subBtn.onclick = function(e){
			if(uName.value != '' && uPhone.value != '' && uMsg.value != ''){
				// 留言成功了
			}else{
				e.preventDefault();
				tips.innerHTML = '我日 没有输入信息，你玩我嘛！';
				// omg 没有信息
			}
		};
	
</script>
</body>
</html>